<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>催办</title>
    <#include "/pubHeadStyle.html">
</head>
<body>

<script type="text/html" template>
    <div class="ccpui-tablesize user" style="width: 96%; margin: 0 auto">
        <table class="layui-table">
            <colgroup>
                <col width="10">
                <col width="200">
            </colgroup>
            <tbody>
            <tr>
                <input type="hidden" name="procInstId" id="procInstId">
                <input type="hidden" name="processSubject" id="processSubject">
            </tr>
            <tr id="sendMethod">
                <th class="layui-bg-gray">发送方式</th>
                <td><label><input type="checkbox" checked="checked" name="messgeType" id="messgeType" value="3"/>站内消息</label></td>
            </tr>
            <tr>
                <th class="layui-bg-gray">提醒消息</th>
                <td>
                    <textarea id="opinion" name="opinion" class="layui-textarea" validate="{required:true,maxLength:1000}" maxLength="1000"></textarea>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div style="text-align: center;position: absolute;bottom: 15px;left: 0px;width: 100%;">
        <a class="layui-btn" lay-event="urgent" id="urgent">
            <i class="layui-icon"></i>
            <span>催办</span>
        </a>
        <a class="layui-btn layui-btn-danger" id="close">
            <i class="layui-icon"></i>
            <span>取消</span>
        </a>
    </div>

</script>
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','table', 'layer', 'laydate', 'form', 'util', 'commons', 'setter', 'totalFilter', 'common'], function (d) {
        var layer = layui.layer;
        var $ = layui.$;
        var setter = layui.setter;

        var procInstId = "${procInstId}";
        var processSubject = "${processSubject}";
        //初始化
        init();

        function init() {
            $('#procInstId').val(procInstId);
            $('#processSubject').val(processSubject);
        }

        //执行催办
        $('#urgent').click(function () {
            var opinion = $('#opinion').val();
            var messgeType = $('#messgeType').val();
            $.ajax({
                url: serverPath.workflowPath + setter.workflowLinkPath + "processRun/urgeSubmit",
                type: 'post',
                dataType: 'json',
                data: {
                    "procInstId": procInstId,
                    "processSubject": processSubject,
                    "opinion": opinion,
                    "messgeType": messgeType
                },
                success:function (data) {
                    layer.open({
                        title: '提示'
                        ,content: data.msg
                        , yes: function(){
                            var index=parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index) ; //如果设定了yes回调，需进行手工关闭
                        }
                    });},
                error:function () {
                  alert("系统错误，请联系管理员！");
                }
            })
        });

        $('#close').click(function () {
            var index=parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        })
    })


</script>
</body>
</html>